home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbasicpg.zip
/
GETRIGHT.BAS
< prev
next >
Wrap
BASIC Source File
|
1989-08-31
|
700b
|
23 lines
' GETRIGHT.BAS
' This program demonstrates the RIGHT$ function.
CLS
alphabet$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ' declare test string
PRINT "How many characters (from right to left) in the following"
PRINT "string would you like to display?"
PRINT
PRINT alphabet$ ' display test string
PRINT
' get from user number of rightmost characters to be displayed
DO ' loop until number is in proper range (1 through 26)
INPUT " Number (1-26): ", rightNum%
LOOP WHILE (rightNum% < 1) OR (rightNum% > 26)
PRINT
rightChar$ = RIGHT$(alphabet$, rightNum%) ' display characters
PRINT "You specified"; LEN(rightChar$); "characters: "; rightChar$